﻿<%@ Page Language="C#" MasterPageFile="~/Templates/Public.master" AutoEventWireup="true"
    CodeFile="marketplace.aspx.cs" Inherits="marketplace" %>

<%@ Register Src="Controls/wucPostUser.ascx" TagName="wucPostUser" TagPrefix="uc1" %>
<%@ Register Assembly="Jalal.Library" Namespace="Jalal.Library.Web.Control" TagPrefix="ucc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="Javascripts/JQuery/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="Javascripts/JQuery/jquery.curvycorners.source.js" type="text/javascript"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table style="width: 100%;">
        <tr class="PostCategory">
            <td style="padding-left: 5px;">
                <asp:Literal ID="litTitle" runat="server">MarketPlace</asp:Literal>
            </td>
        </tr>
        <tr>
            <td align="left" valign="middle" class="Seperator">
                <asp:ImageButton ID="imbStartTopic" runat="server" SkinID="ImageStartNewTopic" OnClick="imbStartTopic_Click" />
            </td>
        </tr>
        <tr>
            <td align="left" valign="top">
                <table cellpadding="0" cellspacing="0" border="0">
                    <asp:Repeater ID="repMarketPlace" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td align="left" valign="top" style="width: 80%;">
                                    <div class="myBox">
                                        <table border="0" width="100%" cellpadding="4">
                                            <tr>
                                                <td align="left" valign="top" width="90%">
                                                    <table cellpadding="0" cellspacing="0" border="0">
                                                        <tr>
                                                            <td align="left" valign="top">
                                                                <font style="color: #F8DF37; font-weight: bold;">Published on: </font>
                                                                <%# string.Format("{0:ddd, dd MMM yyyy hh:mm tt}", Eval("Date").ToString())%>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="top">
                                                                <font style="color: #F8DF37; font-weight: bold;">Title: </font>
                                                                <%# Server.HtmlDecode(Eval("Title").ToString())%>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <%# Server.HtmlDecode(Eval("MarketContent").ToString())%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td align="left" valign="top" width="10%">
                                                    <a href="" class="Navigation" visible='<%# Eval("ShowContactInfo").ToString()=="True"? true:false %>'
                                                        onclick='javascript:ShowMessageDiv("<%# Eval("ContactInfo").ToString()%>");return false;'>
                                                        <ucc:ThemeImage ID="ThemeImage2" runat="server" ImageUrl="Contacts.png" Visible='<%# Eval("ShowContactInfo").ToString()=="True"? true:false %>' /></a>
                                                    <%-- <a href="" class="Navigation" onclick="javascript:ShowHideReplyDiv('<%# Eval("UserID").ToString()%>','<%# Server.HtmlDecode(Eval("Title").ToString())%>');return false;">
                                                        <ucc:ThemeImage ID="ThemeImage1" runat="server" ImageUrl="Sent-Mail.png" /></a>--%>
                                                    <asp:ImageButton ID="imbPopup" runat="server" ImageUrl="~/App_Themes/UserDefault/image/Sent-Mail.png" />
                                                    <act:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="Send_Private_Message_Background"
                                                        TargetControlID="imbPopup" PopupControlID="pnlSendMessage" DropShadow="false"
                                                        CancelControlID="btnCancel">
                                                    </act:ModalPopupExtender>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </td>
        </tr>
    </table>
    <div id="divShowContact" style="position: absolute; background-color: Black; border: solid 1px #8F9394;
        overflow: hidden; height: 210px; width: 500px; text-align: left; padding: 10px 10px 10px 10px;">
        <table width="100%" cellpadding="3" cellspacing="0" border="0" style="height: 210px;">
            <tr class="PostCategory">
                <td colspan="2" align="left" valign="top" style="padding-left: 5px;">
                    Contact Information
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="top" style="padding-left: 5px;">
                    <span id="spnContactInfo"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center" valign="bottom">
                    <asp:Button ID="btnOK" CausesValidation="false" runat="server" Text="Ok" CssClass="PostButton"
                        OnClientClick="javascript:ShowMessageDiv('');return false;" />
                </td>
            </tr>
        </table>
    </div>
    <div id="divPrivateMessage" style="position: absolute; background-color: Black; border: solid 1px #8F9394;
        overflow: hidden; height: 210px; width: 500px; text-align: left; padding: 10px 10px 10px 10px;">
    </div>

    <script type="text/javascript">
     
    $(document).ready(function(){ 
       $("#divPrivateMessage").hide(); 
        
        $("#divShowContact").hide(); 
    });


    function ShowMessageDiv(mesage)
    {
        var divShowContact = $("#divShowContact");
        $("#spnContactInfo").text(mesage);
        divShowContact.css("top", ( $(window).height() - divShowContact.height() ) / 2 +$(window).scrollTop()+ "px");
        divShowContact.css("left", ( $(window).width() - divShowContact.width() ) / 2+$(window).scrollLeft() + "px");
        divShowContact.slideToggle("slow");
    }
    function ShowHideReplyDiv(userId,title)
    {   
        var divPrivateMessage = $("#divPrivateMessage");
        if(title!=null)
        {
            var txtSubject = $("#"+"<%= txtSubject.ClientID  %>");
            txtSubject.val("RE:"+title);
        }
        
        var txtUserID = $("#"+"<%= txtUserID.ClientID  %>");
        txtUserID.val(userId);
        
        divPrivateMessage.css("top", ( $(window).height() - divPrivateMessage.height() ) / 2 + "px");
        divPrivateMessage.css("left", ( $(window).width() - divPrivateMessage.width() ) / 2+$(window).scrollLeft() + "px");
       // divPrivateMessage.corner();
        divPrivateMessage.slideToggle("slow");
    } 
    </script>

    <script type="text/JavaScript">

  $(function(){ 
  
  settings = {
          tl: { radius: 15 },
          tr: { radius: 15 },
          bl: { radius: 15 },
          br: { radius: 15 },
          antiAlias: true,
          autoPad: true,
          validTags: ["div"]
      }

  $('.myBox').corner(settings);
  
  });;

    </script>

    <asp:Panel ID="pnlSendMessage" runat="server" CssClass="Send_Private_Message">
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr class="PostCategory">
                <td colspan="2" align="left" valign="top" style="padding-left: 5px;">
                    Private Message
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="top">
                    <b>Subject:</b>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="top">
                    <asp:TextBox ID="txtSubject" runat="server" Width="90%"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtSubject" ControlToValidate="txtSubject" runat="server" ErrorMessage="*" ValidationGroup="SendPrivateMessage"  Display="Static"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="top">
                    <b>Body</b><input id="txtUserID" type="hidden" runat="server" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="top">
                    <asp:TextBox ID="txtBody" runat="server" Width="90%" Height="103px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtBody" ValidationGroup="SendPrivateMessage" ControlToValidate="txtBody" runat="server"
                        ErrorMessage="*" Display="Static"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left" valign="bottom">
                    <asp:Button ID="btnCancel" CausesValidation="false" runat="server" Text="Cancel"
                        CssClass="PostButton" />
                    <asp:Button ID="btnSendMessage" ValidationGroup="SendPrivateMessage" runat="server" Text="Send" CssClass="PostButton"
                        OnCommand="btnSendMessage_Command" />
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" runat="Server">
</asp:Content>
